package com.example.socket.disruptor;

import com.example.socket.config.SpringUtil;
import com.example.socket.model.SeckillEvent;
import com.example.socket.service.ISeckillService;
import com.lmax.disruptor.EventHandler;

/**
 * Created with IDEA
 * author:QinWei
 * Date:2019/5/21
 * Time:9:45
 */
public class SeckillEventConsumer implements EventHandler<SeckillEvent> {

    private ISeckillService seckillService = (ISeckillService) SpringUtil.getBean("seckillService");

    @Override
    public void onEvent(SeckillEvent seckillEvent, long seq, boolean bool) throws Exception {
        seckillService.startSeckil(seckillEvent.getSeckillId(), seckillEvent.getUserId());
    }
}
